package com.example.automanagement.service.serviceImpl;

import com.example.automanagement.entity.*;
import com.example.automanagement.mapper.ApplicationMapper;
import com.example.automanagement.service.ApplicationService;
import com.example.automanagement.views.DepartmentRole;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

@Service
public class ApplicationServiceImpl implements ApplicationService {
    @Resource
    private ApplicationMapper applicationMapper;
    @Override
    public void addAutoOrder(AutoOrder autoOrder){
        applicationMapper.addAutoOrder(autoOrder);
    }
    @Override
    public void addRepairOrder(RepairOrder repairOrder){
        applicationMapper.addRepairOrder(repairOrder);
    }

    @Override
    public DepartmentRole getUserIdByDR(String userRole, String userDepartment) {
        return applicationMapper.getUserIdByDR(userRole, userDepartment);
    }
    @Override
    public GeneralRole getUserIdByGn() {
        return applicationMapper.getUserIdByGn();
    }

    @Override
    public void addTodo(ToDo toDo) {
         applicationMapper.addTodo(toDo);
    }

    @Override
    public void updateAutoOrderProgress(String orderId , String autoOrderProgress) {
        applicationMapper.updateAutoOrderStatus(orderId, autoOrderProgress);
    }

    @Override
    public void updateRepairOrderProgress(String orderId, String repairOrderProgress) {
        applicationMapper.updateRepairOrderStatus(orderId,repairOrderProgress);
    }

    @Override
    public AutoOrder getAutoOrderIdByTime(String submitTime) {
        return applicationMapper.getAutoOrderIdByTime(submitTime);
    }
    @Override
    public RepairOrder getRepairOrderIdByTime(String submitTime) {
        return applicationMapper.getRepairOrderIdByTime(submitTime);
    }

    @Override
    public void updateTodoDone(String todoType, String orderId) {
        applicationMapper.updateTodoDone(todoType,orderId);
    }
}
